import { QXEvent } from 'qx-util';
import {
	IParam,
	PickupViewPanelActionType,
	IPickupViewPanelAbility,
	IPickupViewPanelControllerParams,
	IPickupViewPanelStore,
	PickupViewPanelController,
	ICtrlEvent,
	IPickupViewPanelController,
	IPickupViewPanelModel,
} from '@/core';
import {
	usePickupViewPanelAction,
	usePickupViewPanelBasic,
	usePickupViewPanelControllerParams,
	usePickupViewPanelProps,
} from '@/hooks/widget/use-pickup-view-panel';
import { model } from './parent-org-pickup-viewpickupviewpanel-pickup-view-panel-model';
// 基于template/src/widgets/{{appEntities}}/{{ctrls@PICKUPVIEWPANEL}}-pickup-view-panel/{{spinalCase ctrl.codeName}}-pickup-view-panel-hook.ts.hbs生成
/**
 * 获取输入参数
 *
 * @export
 * @return {*}
 */
export function useProps() {
	return {
		...usePickupViewPanelProps(),
	};
}

/**
 * 获取基础数据
 *
 * @export
 * @param {*} props
 * @return {*}
 */
export function useBasic(props: any) {
	return {
		...usePickupViewPanelBasic(model, props),
	};
}

/**
 * 获取行为
 *
 * @export
 */
export function useAction(controller: any) {
	return {
		...usePickupViewPanelAction(controller),
	};
}

/**
 * 获取控制器
 *
 * @export
 * @param {IParam} props
 * @param {QXEvent<ICtrlEvent<PickupViewPanelActionType, IPickupViewPanelAbility>>} evt
 * @return {*}
 */
export function useController(
	props: IParam,
	evt: QXEvent<ICtrlEvent<PickupViewPanelActionType, IPickupViewPanelAbility>>,
	otherParams: IParam = {}
): IPickupViewPanelController<IPickupViewPanelStore, IPickupViewPanelAbility> {
	const params: IPickupViewPanelControllerParams<
		PickupViewPanelActionType,
		IPickupViewPanelAbility
	> = usePickupViewPanelControllerParams<
		IPickupViewPanelStore,
		IPickupViewPanelModel
	>(model, props, evt, otherParams);
	return new PickupViewPanelController(params);
}
